class Solution {
public:
    bool isstring(string s,int left,int right)
    {
        while(left<right)
        {
            if(s[left]!=s[right])
            {
                return false;
            }
            left++;
            right--;
        }
        return true;
    }

    bool validPalindrome(string s) {
        int n=s.size();
        int left=0,right=n-1;
        while(left<right)
        {
            if(s[left]!=s[right])
            return isstring(s,left+1,right)|| isstring(s,left,right-1);
            
            left++;
            right--;
        }

        return true;
    }
};